import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
// import storage from '@utils/storage'

import state from './state'
import actions from './actions'
import getters from './getters'
import mutations from './mutations'

// modules
import user from './modules/user'
import task from './modules/task'
import filter from './modules/device-filter'

Vue.use(Vuex)
const debug = process.env.NODE_ENV !== 'production'
let storage = window.localStorage

export default new Vuex.Store({
  state,
  actions,
  getters,
  mutations,
  modules: {
    user,
    task,
    filter
  },
  strict: debug,
  plugins: [createPersistedState(
    {
      path: ['user'],
      storage
    }
  )]
})
